<template>
  <div class="goodsdesc-container">
    <h3>{{info.title}}</h3>
    <hr>
    <div class="content" v-html="info.content"></div>
  </div>
</template>

<script>
import {Toast} from 'mint-ui'

export default {
  data(){
      return {
          id:this.$route.params.id,
          info:{}//图文数据
      }
  },
    created(){
    this.getGoodsDesc()
  },
  methods:{
    getGoodsDesc(){//获取商品图文介绍
        this.$axios({
            method:'get',
            url:'/api/goods/getdesc/'+this.id,
        }).then((response) =>{          //这里使用了ES6的语法
            //console.log(response)       //请求成功返回的数据
            if(response.data.status===0){
                this.info = response.data.message[0]
            }else{
                Toast('获取商品图文介绍失败！')
            }
        }).catch((error) =>{
            console.log(error)       //请求失败返回的数据
        })
    },
  }
}
</script>

<style lang="scss">
.goodsdesc-container{
    padding: 4px;
    h3{
        font-size: 16px;
        color: #226aff;
        text-align: center;
        margin: 15px 0;
    }
    .content{
        img{
            width: 100%;
        }
    }
}
</style>
